package net.qiqb.core.trace;

import java.io.Serializable;
import java.util.Objects;

/**
 * 相同的 TraceId 表示具有关联的业务。
 */
public class TraceId implements Serializable {

    private final String val;

    public TraceId(String val) {
        this.val = val;
    }

    public String getVal() {
        return val;
    }

    @Override
    public boolean equals(Object object) {
        if (this == object) return true;
        if (object == null || getClass() != object.getClass()) return false;

        TraceId traceId = (TraceId) object;

        return Objects.equals(val, traceId.val);
    }

    @Override
    public int hashCode() {
        return val != null ? val.hashCode() : 0;
    }
}
